package com.mrtaohuan.data.entity;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import com.googlecode.objectify.annotation.Cache;
import com.googlecode.objectify.annotation.Entity;
import com.googlecode.objectify.annotation.Id;
import com.mrtaohuan.constant.UserStatus;
import com.mrtaohuan.util.Strings;

@Entity(name = "User")
@Cache
@NoArgsConstructor
public class User {

	@Id
	@Getter
	@Setter
	String email;
	@Getter
	@Setter
	String name;
	@Getter
	@Setter
	String site;
	@Getter
	@Setter
	int status = UserStatus.VALID;
	@Getter
	@Setter
	String password;

	public User(String email, String password, String name, String site) {
		super();
		this.email = email;
		this.name = Strings.isNullOrEmpty(name) ? email.split("@")[0] : name;
		this.site = site;
		this.password = Strings.isNullOrEmpty(password) ? "" : password;
	}

}
